package com.xxd;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
//@EnableEurekaClient
@RestController
@EnableDiscoveryClient
public class ServiceHi8763Application {

    public static void main(String[] args) {
        SpringApplication.run( ServiceHi8763Application.class, args );
    }

    @Value("${server.port}")
    String port;

    @RequestMapping("/hi")
    public String home(@RequestParam(value = "name", defaultValue = "forezp") String name) {
        return "hi " + name + " ,i am from port:" + port;
    }

    @RequestMapping("/gateWayTest1/{id}")
    public String gateWayTest1(@PathVariable("id") Long id) {
        return port + " ,success1: id = " + id;
    }

    @RequestMapping("/gateWayTest2/{id}")
    public String gateWayTest2(@PathVariable("id") Long id) {

        return port + " ,success2: id = " + id;
    }
}
